package services

import (
	"GOPAAS/internal/app/model"
)

type ProductService struct {
	model.ProductProduct
}

func GetProductService(pid int64) *ProductService {
	db = getDB()
	var product model.ProductProduct
	if pid > 0 {
		db.First(&product, pid)
	}
	return &ProductService{product}
}

type ProductTmplService struct {
	model.ProductTemplate
}

func GetProductTmplService(pid int64) *ProductTmplService {
	db = getDB()
	var productTemplate model.ProductTemplate
	if pid > 0 {
		db.First(&productTemplate, pid)
	}
	return &ProductTmplService{productTemplate}
}

type ProductShopDetail struct {
	Name          string  `json:"name"`
	Cover         string  `json:"cover"`
	ProductTempId int64   `json:"product_temp_id"`
	Price         float64 `json:"price"`
}
